home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / gdb-4.12 / configur < prev    next >
Encoding:
Text File  |  1994-02-03  |  39.7 KB  |  1,014 lines

  1. #!/bin/sh
  2.  
  3. ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
  4.  
  5. # Configuration script
  6. #   Copyright (C) 1988, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  7.  
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. # Please email any bugs, comments, and/or additions to this file to:
  21. # bug-gdb@prep.ai.mit.edu
  22.  
  23. # This file was written by K. Richard Pixley.
  24.  
  25. #
  26. # Shell script to create proper links to machine-dependent files in
  27. # preparation for compilation.
  28. #
  29. # If configure succeeds, it leaves its status in config.status.
  30. # If configure fails after disturbing the status quo, 
  31. #       config.status is removed.
  32. #
  33.  
  34. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  35.  
  36. remove=rm
  37. hard_link=ln
  38. symbolic_link='ln -s'
  39.  
  40. #for Test
  41. #remove="echo rm"
  42. #hard_link="echo ln"
  43. #symbolic_link="echo ln -s"
  44.  
  45. # clear some things potentially inherited from environment.
  46.  
  47. Makefile=Makefile
  48. Makefile_in=Makefile.in
  49. arguments=$*
  50. build_alias=
  51. configdirs=
  52. exec_prefix=
  53. exec_prefixoption=
  54. fatal=
  55. floating_point=default
  56. gas=default
  57. host_alias=
  58. host_makefile_frag=
  59. moveifchange=
  60. next_build=
  61. next_host=
  62. next_prefix=
  63. next_site=
  64. next_srcdir=
  65. next_target=
  66. next_tmpdir=
  67. norecursion=
  68. package_makefile_frag=
  69. prefix=/usr/local
  70. progname=
  71. program_prefix=
  72. program_prefixoption=
  73. program_suffix=
  74. program_suffixoption=
  75. program_transform_name=
  76. program_transform_nameoption=
  77. redirect=">/dev/null"
  78. removing=
  79. site=
  80. site_makefile_frag=
  81. site_option=
  82. srcdir=
  83. srctrigger=
  84. subdirs=
  85. target_alias=
  86. target_makefile_frag=
  87. undefinedargs=
  88. version="$Revision: 1.173 $"
  89. x11=default
  90.  
  91. ### we might need to use some other shell than /bin/sh for running subshells
  92. #
  93. config_shell=${CONFIG_SHELL-/bin/sh}
  94.  
  95. NO_EDIT="This file was generated automatically by configure.  Do not edit."
  96.  
  97. ## this is a little touchy and won't always work, but...
  98. ##
  99. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  100. ## must) be used as is.
  101. ##
  102. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  103. ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  104. ##
  105.  
  106. progname=$0
  107. # if PWD already has a value, it is probably wrong.
  108. if [ -n "$PWD" ]; then PWD=`pwd`; fi
  109.  
  110. case "${progname}" in
  111. /*) ;;
  112. */*) ;;
  113. *)
  114.         PATH=$PATH:${PWD=`pwd`} ; export PATH
  115.         ;;
  116. esac
  117.  
  118. for arg in $*
  119. do
  120.         # handle things that might have args following as separate words
  121.         if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
  122.         elif [ -n "${next_exec_prefix}" ] ; then
  123.                 exec_prefix=${arg}
  124.                 exec_prefixoption="-exec-prefix=${exec_prefix}"
  125.                 next_exec_prefix=
  126.         elif [ -n "${next_site}" ] ; then site=${arg} ; site_option=-site=${site} ; next_site=
  127.         # remove any possible trailing slash from srcdir.  See note below.
  128.         elif [ -n "${next_srcdir}" ] ; then srcdir=`echo ${arg} | sed -e 's:/$::'` ; next_srcdir=
  129.         elif [ -n "${next_program_prefix}" ] ; then
  130.                 program_prefix=${arg}
  131.                 program_prefixoption="-program_prefix=${program_prefix}"
  132.                 next_program_prefix=
  133.         elif [ -n "${next_program_suffix}" ] ; then
  134.                 program_suffix=${arg}
  135.                 program_suffixoption="-program_suffix=${program_suffix}"
  136.                 next_program_suffix=
  137.         elif [ -n "${next_program_transform_name}" ] ; then
  138.                 # Double any backslashes or dollar signs in the argument
  139.         if [ -n "${arg}" ] ; then
  140.             program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  141.         fi
  142.                 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='${arg}'"
  143.                 next_program_transform_name=
  144.         elif [ -n "${next_build}" ] ; then
  145.                 next_build=
  146.                 case "${build_alias}" in
  147.                 "")
  148.                         build_alias="${arg}"
  149.                         ;;
  150.                 *)
  151.                         echo '***' Can only configure for one build machine at a time.  1>&2
  152.                         fatal=yes
  153.                         ;;
  154.                 esac
  155.         elif [ -n "${next_target}" ] ; then
  156.                 next_target=
  157.                 case "${target_alias}" in
  158.                 "")
  159.                         target_alias="${arg}"
  160.                         ;;
  161.                 *)
  162.                         echo '***' Can only configure for one target at a time.  1>&2
  163.                         fatal=yes
  164.                         ;;
  165.                 esac
  166.         elif [ -n "${next_host}" ] ; then
  167.                 next_host=
  168.                 case "${host_alias}" in
  169.                 "")
  170.                         host_alias="${arg}"
  171.                         ;;
  172.                 *)
  173.                         echo '***' Can only configure for one host at a time.  1>&2
  174.                         fatal=yes
  175.                         ;;
  176.                 esac
  177.         elif [ -n "${next_tmpdir}" ] ; then
  178.                 next_tmpdir=
  179.                 tmpdiroption="--tmpdir=${arg}"
  180.                 TMPDIR=${arg}
  181.  
  182.         else
  183.                 case ${arg} in
  184.                 -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
  185.                         case "${build_alias}" in
  186.                         "") build_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
  187.                         *)
  188.                                 echo '***' Can only configure for one build machine at a time.  1>&2
  189.                                 fatal=yes
  190.                                 ;;
  191.                         esac
  192.                         ;;
  193.                 -build | --build | --buil | --bui | --bu | --b)
  194.                         next_build=yes
  195.                         ;;
  196.                 -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=* | -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* )
  197.                         exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
  198.                         exec_prefixoption=${arg}
  199.                         ;;
  200.                 -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e | -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec-)
  201.                         next_exec_prefix=yes
  202.                         ;;
  203.                 -gas | --g*)
  204.                         gas=yes
  205.                         ;;
  206.                 -help | --he*)
  207.                         fatal=true
  208.                         ;;
  209.                 -host=* | --host=* | --hos=* | --ho=*)
  210.                         case "${host_alias}" in
  211.                         "")
  212.                                 host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
  213.                                 ;;
  214.                         *)
  215.                                 echo '***' Can only configure for one host at a time.  1>&2
  216.                                 fatal=yes
  217.                                 ;;
  218.                         esac
  219.                         ;;
  220.                 -host | --host | --hos | --ho)
  221.                         case "${host_alias}" in
  222.                         "")
  223.                                 next_host=yes
  224.                                 ;;
  225.                         *)
  226.                                 echo '***' Can only configure for one host at a time.  1>&2
  227.                                 fatal=yes
  228.                                 ;;
  229.                         esac
  230.                         ;;
  231.                 -nfp | --nf*)
  232.                         floating_point=no
  233.                         ;;
  234.                 -norecursion | --no*)
  235.                         norecursion=true
  236.                         ;;
  237.                 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*)
  238.                         prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
  239.                         prefixoption=${arg}
  240.                         ;;
  241.                 -prefix | --prefix | --prefi | --pref | --pre)
  242.                         next_prefix=yes
  243.                         ;;
  244.                 -rm | --rm) removing=${arg} ;;
  245.                 -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | -program-prefix=* | --program-prefix=* | --program-prefi=* | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  246.                         program_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
  247.                         program_prefixoption=${arg}
  248.                         ;;
  249.                 -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | -program-prefix | --program-prefix | --program-prefi | --program-pref | --program-pre | --program-pr | --program-p)
  250.                         next_program_prefix=yes
  251.                         ;;
  252.                 -program_suffix=* | --program_suffix=* | --program_suffi=* | --program_suff=* | --program_suf=* | --program_su=* | --program_s=* | -program-suffix=* | --program-suffix=* | --program-suffi=* | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  253.                         program_suffix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
  254.                         program_suffixoption=${arg}
  255.                         ;;
  256.                 -program_suffix | --program_suffix | --program_suffi | --program_suff | --program_suf | --program_su | --program_s |-program-suffix | --program-suffix | --program-suffi | --program-suff | --program-suf | --program-su | --program-s)
  257.                         next_program_suffix=yes
  258.                         ;;
  259.                 -program_transform_name=* | --program_transform_name=* | --program_transform_nam=* | --program_transform_na=* | --program_transform_n=* | --program_transform_=* | --program_transform=* | --program_transfor=* | --program_transfo=* | --program_transf=* | --program_trans=* | --program_tran=* | --program_tra=* | --program_tr=* | --program_t=* | -program-transform-name=* | --program-transform-name=* | --program-transform-nam=* | --program-transform-na=* | --program-transform-n=* | --program-transform-=* | --program-transform=* | --program-transfor=* | --program-transfo=* | --program-transf=* | --program-trans=* | --program-tran=* | --program-tra=* | --program-tr=* | --program-t=*)
  260.             arg=`echo ${arg} | sed -e 's/^[-a-z_]*=//'`
  261.                         # Double any \ or $ in the argument
  262.             if [ -n "${arg}" ] ; then
  263.                             program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  264.             fi
  265.                         program_transform_nameoption="${program_transform_nameoption} --program-transform-name='${arg}'"
  266.                         ;;
  267.                 -program_transform_name | --program_transform_name | --program_transform_nam | --program_transform_na | --program_transform_n | --program_transform_ | --program_transform | --program_transfor | --program_transfo | --program_transf | --program_trans | --program_tran | --program_tra | --program_tr | --program_t | -program-transform-name | --program-transform-name | --program-transform-nam | --program-transform-na | --program-transform-n | --program-transform- | --program-transform | --program-transfor | --program-transfo | --program-transf | --program-trans | --program-tran | --program-tra | --program-tr | --program-t)
  268.                         next_program_transform_name=yes
  269.                         ;;
  270.                 -site=* | --site=* | --sit=* | --si=*)
  271.                         site_option=${arg}
  272.                         site=`echo ${arg} | sed 's/^[-a-z]*=//'`
  273.                         ;;
  274.                 -site | --site | --sit)
  275.                         next_site=yes
  276.                         ;;
  277.                 # remove trailing slashes.  Otherwise, when the file name gets
  278.                 # bolted into an object file as debug info, it has two slashes in
  279.                 # it.  Ordinarily this is ok, but emacs takes double slash to
  280.                 # mean "forget the first part".
  281.                 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  282.                         srcdir=`echo ${arg} | sed 's/^[-a-z]*=//' | sed -e 's:/$::'`
  283.                         ;;
  284.                 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  285.                         next_srcdir=yes
  286.                         ;;
  287.                 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
  288.                         case "${target_alias}" in
  289.                         "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
  290.                         *)
  291.                                 echo '***' Can only configure for one target at a time.  1>&2
  292.                                 fatal=yes
  293.                                 ;;
  294.                         esac
  295.                         ;;
  296.                 -target | --target | --targe | --targ | --tar | --ta)
  297.                         next_target=yes
  298.                         ;;
  299.                 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
  300.                         tmpdiroption=${arg}
  301.                         TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
  302.                         ;;
  303.                 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
  304.                         next_tmpdir=yes
  305.                         ;;
  306.                 -v | -verbose | --v)
  307.                         redirect=
  308.                         verbose=-v
  309.                         ;;
  310.                 -version | -V | --version | --V)
  311.                         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  312.                         exit 0
  313.                         ;;
  314.                 -with*=* | --with*=*)
  315.                         withopt=`echo ${arg} | sed 's:^-*\(with[^=]*\)=.*$:\1:;s/-/_/g'`
  316.                         withval=`echo ${arg} | sed 's:^-*with[^=]*=\(.*\)$:\1:'`
  317.                         eval $withopt="$withval"
  318.                         withoptions="$withoptions $arg"
  319.                         ;;
  320.                 -without* | --without*)
  321.                         withopt=`echo ${arg} | sed 's:^-*without:with:;s/-/_/g'`        
  322.                         eval $withopt=no
  323.                         withoutoptions="$withoutoptions $arg"
  324.                         ;;
  325.                 -with* | --with*)
  326.                         withopt=`echo ${arg} | sed 's:^-*with:with:;s/-/_/g'`
  327.                         eval $withopt=yes
  328.                         withoptions="$withoptions $arg"
  329.                         ;;
  330.                 -x | --x) ;;
  331.                 -* | --*)
  332.                         (echo ;
  333.                         echo "Unrecognized option: \"${arg}\"". ;
  334.                         echo) 1>&2
  335.                         fatal=true
  336.                         ;;
  337.                 *)
  338.                         case "${undefs}" in
  339.                         "")
  340.                                 undefs="${arg}"
  341.                                 ;;
  342.                         *)
  343.                                 echo '***' Can only configure for one host and one target at a time.  1>&2
  344.                                 fatal=yes
  345.                                 ;;
  346.                         esac
  347.                         ;;
  348.                 esac
  349.         fi
  350. done
  351.  
  352. # process host and target
  353. case "${fatal}" in
  354. "")
  355. #       # Complain if an arg is missing
  356. #       if [ -z "${host_alias}" ] ; then
  357. #               (echo ;
  358. #               echo "configure: No HOST specified." ;
  359. #               echo) 1>&2
  360. #               fatal=true
  361. #       fi
  362.  
  363. ### This is a bit twisted.
  364. ### * if all three are specified, this is an error.
  365. ### * if we have neither hosts, nor unadorned args, guess with config.guess.
  366. ### * if no hosts are specified, then the unadorned args are hosts, but if
  367. ### there were none, this is an error.
  368. ### * if no targets are specified, then the unadorned args are targets, but if
  369. ### there were no unadorned args, then the hosts are also targets.
  370.  
  371.         if [ -n "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ]
  372.     then
  373.                 echo '***' Can only configure for one host and one target at a time.  1>&2
  374.                 fatal=yes
  375.         elif [ -z "${host_alias}" -a -z "${undefs}" ]
  376.     then
  377.                 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  378.                 if tmp_alias=`${guesssys}` ; then
  379.                         echo "Configuring for a ${tmp_alias} host." 1>&2
  380.                         host_alias=${tmp_alias}
  381.             case "${target_alias}" in
  382.             "") target_alias=${tmp_alias} ;;
  383.             *) ;;
  384.             esac
  385.             arguments="--host=${host_alias} ${arguments}"
  386.                 else
  387.                         echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  388.                         fatal=yes
  389.                 fi
  390.         else
  391.                 case "${host_alias}" in
  392.         "") host_alias=${undefs} ;;
  393.                 *) ;;
  394.                 esac
  395.  
  396.                 case "${target_alias}" in
  397.                 "")
  398.                         case "${undefs}" in
  399.                         "")     target_alias=${host_alias} ;;
  400.                         *)      target_alias=${undefs} ;;
  401.                         esac
  402.                         ;;
  403.                 *) ;;
  404.                 esac
  405.         fi
  406.         ;;
  407. *) ;;
  408. esac
  409.  
  410. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  411.         (echo "Usage: configure HOST" ;
  412.         echo ;
  413.         echo "Options: [defaults in brackets]" ;
  414.         echo " --prefix=MYDIR            configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
  415.         echo " --exec-prefix=MYDIR       configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
  416.         echo " --help                    print this message. [normal config]" ;
  417.         echo " --build=BUILD             configure for building on BUILD.  [BUILD=HOST]" ;
  418.         echo " --host=HOST               configure for HOST.  [determined via config.guess]" ;
  419.         echo " --norecursion             configure this directory only. [recurse]" ;
  420.         echo " --program-prefix=FOO      install programs with FOO prepended to their names. [ \"\" ]" ;
  421.         echo " --program-suffix=FOO      install programs with FOO appended to their names. [ \"\" ]" ;
  422.         echo " --program-transform-name=FOO      install programs with names transformed by sed pattern FOO. [ \"\" ]" ;
  423.         echo " --site=SITE               configure with site specific makefile for SITE" ;
  424.         echo " --srcdir=DIR              find the sources in DIR. [\".\" or \"..\"]" ;
  425.         echo " --target=TARGET           configure for TARGET.  [TARGET = HOST]" ;
  426.         echo " --tmpdir=TMPDIR           create temporary files in TMPDIR.  [ TMPDIR = \"/tmp\" ]" ;
  427.         echo " --nfp                     configure the compilers default to soft floating point. [hard float]" ;
  428.         echo " --with-FOO, --with-FOO=BAR specify that FOO is available"
  429.         echo " --without-FOO             specify that FOO is NOT available"
  430.         echo ;
  431.         echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
  432.         echo ;
  433.         ) 1>&2
  434.         if [ -r config.status ] ; then
  435.                 cat config.status
  436.         fi
  437.  
  438.         exit 1
  439. fi
  440.  
  441. configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  442. moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  443.  
  444. # this is a hack.  sun4 must always be a valid host alias or this will fail.
  445. if ${configsub} sun4 >/dev/null 2>&1 ; then
  446.         true
  447. else
  448.         echo '***' cannot find config.sub.  1>&2
  449.         exit 1
  450. fi
  451.  
  452. touch config.junk
  453. if ${moveifchange} config.junk config.trash ; then
  454.         true
  455. else
  456.         echo '***' cannot find move-if-change.  1>&2
  457.         exit 1
  458. fi
  459. rm -f config.junk config.trash
  460.  
  461. case "${srcdir}" in
  462. "")
  463.         if [ -r configure.in ] ; then
  464.                 srcdir=.
  465.         else
  466.                 if [ -r ${progname}.in ] ; then
  467.                         srcdir=`echo ${progname} | sed 's:/configure$::'`
  468.                 else
  469.                         echo '***' "Can't find configure.in.  Try using -srcdir=some_dir"  1>&2
  470.                         exit 1
  471.                 fi
  472.         fi
  473.         ;;
  474. *) ;;
  475. esac
  476.  
  477. ### warn about some conflicting configurations.
  478.  
  479. case "${srcdir}" in
  480. ".") ;;
  481. *)
  482.         if [ -f ${srcdir}/config.status ] ; then
  483.                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  484.                 exit 1
  485.         fi
  486. esac
  487.  
  488. # default exec_prefix
  489. case "${exec_prefix}" in
  490. "") exec_prefix="\$(prefix)" ;;
  491. *) ;;
  492. esac
  493.  
  494. ### break up ${srcdir}/configure.in.
  495. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  496. "")
  497.         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  498.         exit 1
  499.         ;;
  500. *) ;;
  501. esac
  502.  
  503. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  504. "")
  505.         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  506.         exit 1
  507.         ;;
  508. *) ;;
  509. esac
  510.  
  511. case "${TMPDIR}" in
  512. "") TMPDIR=/tmp ; export TMPDIR ;;
  513. *) ;;
  514. esac
  515.  
  516. # keep this filename short for &%*%$*# 14 char file names
  517. tmpfile=${TMPDIR}/cONf$$
  518. trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
  519.  
  520. # split ${srcdir}/configure.in into common, per-host, per-target,
  521. # and post-target parts.  Post-target is optional.
  522. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  523. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  524. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  525.   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  526.   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  527. else
  528.   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  529.   echo >${tmpfile}.pos
  530. fi
  531.  
  532. ### do common part of configure.in
  533.  
  534. . ${tmpfile}.com
  535.  
  536. # some sanity checks on configure.in
  537. case "${srctrigger}" in
  538. "")
  539.         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
  540.         exit 1
  541.         ;;
  542. *) ;;
  543. esac
  544.  
  545. case "${build_alias}" in
  546. "")    ;;
  547. *)
  548.     result=`${configsub} ${build_alias}`
  549.         buildopt="--build=${build_alias}"
  550.     build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  551.     build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  552.     build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  553.     build=${build_cpu}-${build_vendor}-${build_os}
  554.     ;;
  555. esac
  556.  
  557. result=`${configsub} ${host_alias}`
  558. host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  559. host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  560. host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  561. host=${host_cpu}-${host_vendor}-${host_os}
  562.  
  563. . ${tmpfile}.hst
  564.  
  565. result=`${configsub} ${target_alias}`
  566. target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  567. target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  568. target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  569. target=${target_cpu}-${target_vendor}-${target_os}
  570.  
  571. . ${tmpfile}.tgt
  572.  
  573. # Find the source files, if location was not specified.
  574. case "${srcdir}" in
  575. "")
  576.         srcdirdefaulted=1
  577.         srcdir=.
  578.         if [ ! -r ${srctrigger} ] ; then
  579.                 srcdir=..
  580.         fi
  581.         ;;
  582. *) ;;
  583. esac
  584.  
  585. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  586.         case "${srcdirdefaulted}" in
  587.         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  588.         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  589.         esac
  590.  
  591.         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  592.         exit 1
  593. fi
  594.  
  595. # Some systems (e.g., one of the i386-aix systems the gas testers are
  596. # using) don't handle "\$" correctly, so don't use it here.
  597. tooldir='$(exec_prefix)'/${target_alias}
  598.  
  599. if [ "${host_alias}" != "${target_alias}" ] ; then
  600.     if [ "${program_prefixoption}" = "" ] ; then
  601.         if [ "${program_suffixoption}" = "" ] ; then 
  602.             if [ "${program_transform_nameoption}" = "" ] ; then
  603.                 program_prefix=${target_alias}- ;
  604.             fi
  605.         fi
  606.     fi
  607. fi
  608.  
  609. # Merge program_prefix and program_suffix onto program_transform_name
  610. # Use a double $ so that make ignores it
  611. if [ "${program_suffix}" != "" ] ; then
  612.     program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
  613. fi
  614.  
  615. if [ "${program_prefix}" != "" ] ; then
  616.     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
  617. fi
  618.  
  619. for subdir in . ${subdirs} ; do
  620.  
  621.     # ${subdir} is relative path from . to the directory we're currently
  622.     # configuring.
  623.     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  624.     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  625.  
  626.     ### figure out what to do with srcdir
  627.     case "${srcdir}" in
  628.         ".")  # no -srcdir option.  We're building in place.
  629.                 makesrcdir=. ;;
  630.         /*) # absolute path
  631.                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  632.                 ;;
  633.         *) # otherwise relative
  634.                 case "${subdir}" in
  635.                 .) makesrcdir=${srcdir} ;;
  636.                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  637.                 esac
  638.                 ;;
  639.     esac
  640.  
  641.     if [ "${subdir}/" != "./" ] ; then
  642.         Makefile=${subdir}/Makefile
  643.     fi
  644.  
  645.     if [ ! -d ${subdir} ] ; then
  646.         if mkdir ${subdir} ; then
  647.                 true
  648.         else
  649.                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  650.                 exit 1
  651.         fi
  652.     fi
  653.  
  654.     case "${removing}" in
  655.     "")
  656.         case "${subdir}" in
  657.         .) ;;
  658.         *) eval echo Building in ${subdir} ${redirect} ;;
  659.         esac
  660.  
  661.         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  662.         # Set up the list of links to be made.
  663.         # ${links} is the list of link names, and ${files} is the list of names to link to.
  664.  
  665.         # Make the links.
  666.         configlinks="${links}"
  667.         if [ -r ${subdir}/config.status ] ; then
  668.                 mv -f ${subdir}/config.status ${subdir}/config.back
  669.         fi
  670.         while [ -n "${files}" ] ; do
  671.                 # set file to car of files, files to cdr of files
  672.                 set ${files}; file=$1; shift; files=$*
  673.                 set ${links}; link=$1; shift; links=$*
  674.  
  675.                 if [ ! -r ${srcdir}/${file} ] ; then
  676.                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  677.                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  678.                         exit 1
  679.                 fi
  680.  
  681.                 ${remove} -f ${link}
  682.                 # Make a symlink if possible, otherwise try a hard link
  683.                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
  684.  
  685.                 if [ ! -r ${link} ] ; then
  686.                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  687.                         exit 1
  688.                 fi
  689.  
  690.                 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  691.         done
  692.  
  693.         # Create a .gdbinit file which runs the one in srcdir
  694.         # and tells GDB to look there for source files.
  695.  
  696.         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  697.                 case ${srcdir} in
  698.                 .) ;;
  699.                 *) cat > ${subdir}/.gdbinit <<EOF
  700. # ${NO_EDIT}
  701. dir .
  702. dir ${makesrcdir}
  703. source ${makesrcdir}/.gdbinit
  704. EOF
  705.                         ;;
  706.                 esac
  707.         fi
  708.  
  709.         # Install a makefile, and make it set VPATH
  710.         # if necessary so that the sources are found.
  711.         # Also change its value of srcdir.
  712.         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
  713.         # been somewhat optimized and is perhaps a bit twisty.
  714.  
  715.         # code is order so as to try to sed the smallest input files we know.
  716.  
  717.         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
  718.         # package, target, host, and site.  so do these separately because I don't trust the
  719.         #  order of sed -e expressions.
  720.  
  721.         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  722.  
  723.             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
  724.             rm -f ${subdir}/Makefile.tem
  725.               case "${site}" in
  726.               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  727.               *)
  728.                       site_makefile_frag=${srcdir}/config/ms-${site}
  729.  
  730.                       if [ -f ${site_makefile_frag} ] ; then
  731.                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
  732.                                       > ${subdir}/Makefile.tem
  733.                       else
  734.                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  735.                               site_makefile_frag=
  736.                       fi
  737.                       ;;
  738.             esac
  739.             # working copy now in ${subdir}/Makefile.tem
  740.  
  741.             # Conditionalize the makefile for this host.
  742.             rm -f ${Makefile}
  743.             case "${host_makefile_frag}" in
  744.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  745.               *)
  746.                       if [ ! -f ${host_makefile_frag} ] ; then
  747.                               host_makefile_frag=${srcdir}/${host_makefile_frag}
  748.                       fi
  749.                       if [ -f ${host_makefile_frag} ] ; then
  750.                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  751.                       else
  752.                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  753.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  754.                               mv ${subdir}/Makefile.tem ${Makefile}
  755.                       fi
  756.             esac
  757.             # working copy now in ${Makefile}
  758.  
  759.             # Conditionalize the makefile for this target.
  760.             rm -f ${subdir}/Makefile.tem
  761.             case "${target_makefile_frag}" in
  762.               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  763.               *)
  764.                       if [ ! -f ${target_makefile_frag} ] ; then
  765.                               target_makefile_frag=${srcdir}/${target_makefile_frag}
  766.                       fi
  767.                       if [ -f ${target_makefile_frag} ] ; then
  768.                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  769.                       else
  770.                               mv ${Makefile} ${subdir}/Makefile.tem
  771.                               target_makefile_frag=
  772.                       fi
  773.                       ;;
  774.             esac
  775.             # real copy now in ${subdir}/Makefile.tem
  776.  
  777.             # Conditionalize the makefile for this package.
  778.             rm -f ${Makefile}
  779.             case "${package_makefile_frag}" in
  780.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  781.               *)
  782.                       if [ ! -f ${package_makefile_frag} ] ; then
  783.                               package_makefile_frag=${srcdir}/${package_makefile_frag}
  784.                       fi
  785.                       if [ -f ${package_makefile_frag} ] ; then
  786.                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  787.                       else
  788.                               echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
  789.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  790.                               mv ${subdir}/Makefile.tem ${Makefile}
  791.                       fi
  792.             esac
  793.             # working copy now in ${Makefile}
  794.  
  795.             mv ${Makefile} ${subdir}/Makefile.tem
  796.  
  797.             # real copy now in ${subdir}/Makefile.tem
  798.  
  799.             # prepend warning about editting, and a bunch of variables.
  800.             rm -f ${Makefile}
  801.             cat > ${Makefile} <<EOF
  802. # ${NO_EDIT}
  803. VPATH = ${makesrcdir}
  804. links = ${configlinks}
  805. host_alias = ${host_alias}
  806. host_cpu = ${host_cpu}
  807. host_vendor = ${host_vendor}
  808. host_os = ${host_os}
  809. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  810. target_alias = ${target_alias}
  811. target_cpu = ${target_cpu}
  812. target_vendor = ${target_vendor}
  813. target_os = ${target_os}
  814. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  815. EOF
  816.         case "${build}" in
  817.           "") ;;
  818.           *)  cat >> ${Makefile} << EOF
  819. build_alias = ${build_alias}
  820. build_cpu = ${build_cpu}
  821. build_vendor = ${build_vendor}
  822. build_os = ${build_os}
  823. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  824. EOF
  825.         esac
  826.  
  827.             case "${package_makefile_frag}" in
  828.               "") ;;
  829.               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  830.               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  831.             esac
  832.  
  833.             case "${target_makefile_frag}" in
  834.               "") ;;
  835.               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  836.               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  837.             esac
  838.  
  839.             case "${host_makefile_frag}" in
  840.               "") ;;
  841.               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  842.               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  843.             esac
  844.  
  845.             if [ "${site_makefile_frag}" != "" ] ; then
  846.                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  847.             fi 
  848.  
  849.         # make sure that some sort of reasonable default exists for these 
  850.         # two variables
  851.         CXX=${CXX-"g++ -O"}
  852.         CC=${CC-cc}
  853.  
  854.             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  855.             # remove any form feeds.
  856.             if [ -z "${subdirs}" ]; then
  857.                 rm -f ${subdir}/Makefile.tem2
  858.                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
  859.                     -e "s:^NONSUBDIRS[     ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  860.                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
  861.                 rm -f ${subdir}/Makefile.tem
  862.                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
  863.             fi
  864.             sed -e "s:^prefix[     ]*=.*$:prefix = ${prefix}:" \
  865.                     -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
  866.             -e "s:^SHELL[     ]*=.*$:SHELL = ${config_shell}:" \
  867.                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
  868.                     -e "s/ //" \
  869.                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
  870.                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
  871.                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
  872.                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
  873.                     ${subdir}/Makefile.tem >> ${Makefile}
  874.             # final copy now in ${Makefile}
  875.  
  876.         else
  877.            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  878.         fi
  879.  
  880.         rm -f ${subdir}/Makefile.tem
  881.  
  882.         case "${host_makefile_frag}" in
  883.         "") using= ;;
  884.         *) using="and \"${host_makefile_frag}\"" ;;
  885.         esac
  886.  
  887.         case "${target_makefile_frag}" in
  888.         "") ;;
  889.         *) using="${using} and \"${target_makefile_frag}\"" ;;
  890.         esac
  891.  
  892.         case "${site_makefile_frag}" in
  893.         "") ;;
  894.         *) using="${using} and \"${site_makefile_frag}\"" ;;
  895.         esac
  896.  
  897.         newusing=`echo "${using}" | sed 's/and/using/'`
  898.         using=${newusing}
  899.         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  900.  
  901.         . ${tmpfile}.pos
  902.  
  903.         # describe the chosen configuration in config.status.
  904.         # Make that file a shellscript which will reestablish
  905.         # the same configuration.  Used in Makefiles to rebuild
  906.         # Makefiles.
  907.  
  908.         case "${norecursion}" in
  909.         "") arguments="${arguments} -norecursion" ;;
  910.         *) ;;
  911.         esac
  912.  
  913.         if [ ${subdir} = . ] ; then
  914.             echo "#!/bin/sh
  915. # ${NO_EDIT}
  916. # This directory was configured as follows:
  917. ${progname}" ${arguments}  "
  918. # ${using}" > ${subdir}/config.new
  919.         else
  920.             echo "#!/bin/sh
  921. # ${NO_EDIT}
  922. # This directory was configured as follows:
  923. cd ${invsubdir}
  924. ${progname}" ${arguments}  "
  925. # ${using}" > ${subdir}/config.new
  926.         fi
  927.         chmod a+x ${subdir}/config.new
  928.         if [ -r ${subdir}/config.back ] ; then
  929.                 mv -f ${subdir}/config.back ${subdir}/config.status
  930.         fi
  931.         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  932.         ;;
  933.  
  934.     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  935.     esac
  936. done
  937.  
  938. # If there are subdirectories, then recur. 
  939. if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
  940.         for configdir in ${configdirs} ; do
  941.  
  942.                 if [ -d ${srcdir}/${configdir} ] ; then
  943.                         eval echo Configuring ${configdir}... ${redirect}
  944.                         case "${srcdir}" in
  945.                         ".") ;;
  946.                         *)
  947.                                 if [ ! -d ./${configdir} ] ; then
  948.                                         if mkdir ./${configdir} ; then
  949.                                                 true
  950.                                         else
  951.                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
  952.                                                 exit 1
  953.                                         fi
  954.                                 fi
  955.                                 ;;
  956.                         esac
  957.  
  958.                         POPDIR=${PWD=`pwd`}
  959.                         cd ${configdir} 
  960.  
  961. ### figure out what to do with srcdir
  962.                         case "${srcdir}" in
  963.                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
  964.                         /*) # absolute path
  965.                                 newsrcdir=${srcdir}/${configdir}
  966.                                 srcdiroption="-srcdir=${newsrcdir}"
  967.                                 ;;
  968.                         *) # otherwise relative
  969.                                 newsrcdir=../${srcdir}/${configdir}
  970.                                 srcdiroption="-srcdir=${newsrcdir}"
  971.                                 ;;
  972.                         esac
  973.  
  974. ### check for guested configure, otherwise fix possibly relative progname
  975.                         if [ -f ${newsrcdir}/configure ] ; then
  976.                                 recprog=${newsrcdir}/configure
  977.                         elif [ -f ${newsrcdir}/configure.in ] ; then
  978.                                 case "${progname}" in
  979.                                 /*)     recprog=${progname} ;;
  980.                                 *)      recprog=../${progname} ;;
  981.                                 esac
  982.             else
  983.                 eval echo No configuration information in ${configdir} ${redirect}
  984.                 recprog=
  985.                         fi
  986.  
  987. ### The recursion line is here.
  988.             if [ ! -z "${recprog}" ] ; then
  989.                             if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  990.                                     ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  991.                                     ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${removing} ${redirect} ; then
  992.                                     true
  993.                             else
  994.                                     exit 1
  995.                             fi
  996.             fi
  997.  
  998.                         cd ${POPDIR}
  999.                 fi
  1000.         done
  1001. fi
  1002.  
  1003. exit 0
  1004.  
  1005. #
  1006. # Local Variables:
  1007. # fill-column: 131
  1008. # End:
  1009. #
  1010.  
  1011. # end of configure
  1012.